﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using Zeus.Thunder.Core;

namespace SharpTrainer.Concurrency
{
    class EventAsyncTest : ITestCase
    {
        public void Run()
        {
            string url = "http://localhost:3650/TestHandler.ashx";
            
            WebClient client = new WebClient();
            client.DownloadStringCompleted += ClientOnDownloadDataCompleted;
            client.DownloadStringAsync(new Uri(url));
        }

        private void ClientOnDownloadDataCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            Console.WriteLine();
            if (e.Error == null)
            {
                Console.WriteLine("Download String: {0}", e.Result);
            }
            else
            {
                Console.WriteLine("Error while downloading string!");
            }
            Console.WriteLine();
        }
    }
}

